import axios from 'axios'
/**
 * 基础请求
 */
export default class BaseRequest {
  constructor(config, apiControl) {
    this.config = config
    this.apiControl = apiControl
    this.adapter = this.create()
  }
  create() {
    const service = axios.create(this.config)
    service.interceptors.request.use(this.apiControl.requestBefore, this.apiControl.requestError)
    service.interceptors.response.use(this.apiControl.responseBefore, this.apiControl.responseError)
    return service
  }
}
